home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / c / jpegagasrc / jpegaga / aslscreenmode.c < prev    next >
C/C++ Source or Header  |  1995-11-08  |  2KB  |  88 lines

  1. /* Display an ASL screenmode requester */
  2. /* modified for use with jpegAGA 2.x */
  3.  
  4. #include <exec/types.h>
  5. #include <libraries/asl.h>
  6. #include <utility/tagitem.h>
  7.  
  8. #define __NOLIBBASE__
  9. #include <proto/exec.h>
  10. #include <proto/asl.h>
  11. #include <proto/graphics.h>
  12.  
  13.  
  14. extern ULONG SMR_DisplayID;
  15. extern short SMR_HAM;
  16.  
  17. struct Library *AslBase=NULL;
  18. extern struct GfxBase *GfxBase;
  19.  
  20. struct TagItem smrtags[] = 
  21. { { ASLSM_PropertyFlags, DIPF_IS_AA}, 
  22.   { ASLSM_PropertyMask, DIPF_IS_DUALPF | DIPF_IS_EXTRAHALFBRITE}, 
  23.   { TAG_DONE, 0 }
  24. };
  25.  
  26. struct ScreenModeRequester *smr = NULL;
  27.  
  28. int ChooseScreenMode(int grayscale, char *title)
  29. {
  30.   int ASL_failure=1;
  31.  
  32.   if(grayscale)
  33.     smrtags[1].ti_Data = DIPF_IS_DUALPF | DIPF_IS_EXTRAHALFBRITE | DIPF_IS_HAM;
  34.   else
  35.     smrtags[1].ti_Data = DIPF_IS_DUALPF | DIPF_IS_EXTRAHALFBRITE;
  36.  
  37.  
  38.   if(!GfxBase)
  39.   {
  40.     if(!(GfxBase = (struct GfxBase *)OpenLibrary((UBYTE *)"graphics.library",39)))
  41.     {
  42.       printf("Could not open graphics.library V39 or higher.\n");
  43.       return 1;
  44.     }
  45.   }
  46.  
  47.   if(!AslBase) AslBase=OpenLibrary("asl.library", 39L);
  48.  
  49.   if(AslBase)
  50.   {
  51.     if(!smr) smr = (struct ScreenModeRequester *)
  52.                    AllocAslRequest(ASL_ScreenModeRequest, smrtags);
  53.     if(smr)
  54.     {
  55.       if( AslRequest(smr, 0L) )
  56.       {
  57.         struct DisplayInfo queryinfo;
  58.  
  59.         /* printf("Display type: $%lx\n", smr->sm_DisplayID); */
  60.         SMR_DisplayID = smr->sm_DisplayID;
  61.         if(GetDisplayInfoData(NULL, (UBYTE *)&queryinfo, sizeof(queryinfo),DTAG_DISP,SMR_DisplayID))
  62.         {
  63.           if(queryinfo.PropertyFlags)
  64.           {
  65.             if(queryinfo.PropertyFlags & DIPF_IS_HAM)
  66.               SMR_HAM = 1;
  67.             else SMR_HAM = 0;
  68.  
  69.             /* if(SMR_HAM) printf("Mode is HAM\n"); */
  70.           }
  71.           else ASL_failure = 1;
  72.         }
  73.  
  74.         ASL_failure=0;
  75.  
  76.       }
  77.       else
  78.       {
  79.         /* printf("User cancelled or error...\n"); */
  80.         ASL_failure=1;
  81.       }
  82.     }
  83.     return ASL_failure;
  84.    }
  85.    printf("Could not open asl.library V39 or higher.\n");
  86.    return 1;
  87. }
  88.